package com.hymall.util;

import com.hymall.bean.MarketUser;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

/**
 * @Description 获取userID
 * @Author 徐成喜
 * @Data 2022/7/21 10:30
 */

public class WxCartShiroUtils {

    public static Integer getUserId() {
        Subject subject = SecurityUtils.getSubject();
        MarketUser principal = (MarketUser) subject.getPrincipal();

        Integer useId = null;
        if (principal != null) {
            useId = principal.getId();
            return useId;
        }
        return useId;
    }

}
